package com.rr.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author RR
 * @date 2023/7/2 21:30
 */

//@Aspect
//@Component
@Slf4j
public class LogAspect {

    @Pointcut("@annotation(com.netflix.graphql.dgs.DgsQuery)")
    public void myLog() {

    }

    @Around("myLog()")
    public void around(ProceedingJoinPoint proceedingJoinPoint) {
        log.info("...before...");
        try {
            proceedingJoinPoint.proceed();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
        log.info("...after...");
    }
}
